//
// CVPOperand.java
// Copyright (C) 2010  "Naush" <naush _ hotmail _ fr>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>./* ----------------------------------------------------------------------------







package org.ryzom.nel.threed;

public class CVPOperand {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  public CVPOperand(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(CVPOperand obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nel3dJNI.delete_CVPOperand(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public void setType(CVPOperand.EOperandType value) {
    nel3dJNI.CVPOperand_Type_set(swigCPtr, this, value.swigValue());
  }

  public CVPOperand.EOperandType getType() {
    return CVPOperand.EOperandType.swigToEnum(nel3dJNI.CVPOperand_Type_get(swigCPtr, this));
  }

  public void setIndexed(boolean value) {
    nel3dJNI.CVPOperand_Indexed_set(swigCPtr, this, value);
  }

  public boolean getIndexed() {
    return nel3dJNI.CVPOperand_Indexed_get(swigCPtr, this);
  }

  public void setWriteMask(long value) {
    nel3dJNI.CVPOperand_WriteMask_set(swigCPtr, this, value);
  }

  public long getWriteMask() {
    return nel3dJNI.CVPOperand_WriteMask_get(swigCPtr, this);
  }

  public void setNegate(boolean value) {
    nel3dJNI.CVPOperand_Negate_set(swigCPtr, this, value);
  }

  public boolean getNegate() {
    return nel3dJNI.CVPOperand_Negate_get(swigCPtr, this);
  }

  public void setSwizzle(CVPSwizzle value) {
    nel3dJNI.CVPOperand_Swizzle_set(swigCPtr, this, CVPSwizzle.getCPtr(value), value);
  }

  public CVPSwizzle getSwizzle() {
    long cPtr = nel3dJNI.CVPOperand_Swizzle_get(swigCPtr, this);
    return (cPtr == 0) ? null : new CVPSwizzle(cPtr, false);
  }

  public CVPOperand() {
    this(nel3dJNI.new_CVPOperand(), true);
  }

  public final static class EOperandType {
    public final static EOperandType Variable = new EOperandType("Variable", nel3dJNI.CVPOperand_Variable_get());
    public final static EOperandType Constant = new EOperandType("Constant");
    public final static EOperandType InputRegister = new EOperandType("InputRegister");
    public final static EOperandType OutputRegister = new EOperandType("OutputRegister");
    public final static EOperandType AddressRegister = new EOperandType("AddressRegister");
    public final static EOperandType OperandTypeCount = new EOperandType("OperandTypeCount");

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static EOperandType swigToEnum(int swigValue) {
      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
        return swigValues[swigValue];
      for (int i = 0; i < swigValues.length; i++)
        if (swigValues[i].swigValue == swigValue)
          return swigValues[i];
      throw new IllegalArgumentException("No enum " + EOperandType.class + " with value " + swigValue);
    }

    private EOperandType(String swigName) {
      this.swigName = swigName;
      this.swigValue = swigNext++;
    }

    private EOperandType(String swigName, int swigValue) {
      this.swigName = swigName;
      this.swigValue = swigValue;
      swigNext = swigValue+1;
    }

    private EOperandType(String swigName, EOperandType swigEnum) {
      this.swigName = swigName;
      this.swigValue = swigEnum.swigValue;
      swigNext = this.swigValue+1;
    }

    private static EOperandType[] swigValues = { Variable, Constant, InputRegister, OutputRegister, AddressRegister, OperandTypeCount };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

  public final static class EInputRegister {
    public final static EInputRegister IPosition = new EInputRegister("IPosition", nel3dJNI.CVPOperand_IPosition_get());
    public final static EInputRegister IWeight = new EInputRegister("IWeight");
    public final static EInputRegister INormal = new EInputRegister("INormal");
    public final static EInputRegister IPrimaryColor = new EInputRegister("IPrimaryColor");
    public final static EInputRegister ISecondaryColor = new EInputRegister("ISecondaryColor");
    public final static EInputRegister IFogCoord = new EInputRegister("IFogCoord");
    public final static EInputRegister IPaletteSkin = new EInputRegister("IPaletteSkin");
    public final static EInputRegister IEmpty = new EInputRegister("IEmpty");
    public final static EInputRegister ITex0 = new EInputRegister("ITex0");
    public final static EInputRegister ITex1 = new EInputRegister("ITex1");
    public final static EInputRegister ITex2 = new EInputRegister("ITex2");
    public final static EInputRegister ITex3 = new EInputRegister("ITex3");
    public final static EInputRegister ITex4 = new EInputRegister("ITex4");
    public final static EInputRegister ITex5 = new EInputRegister("ITex5");
    public final static EInputRegister ITex6 = new EInputRegister("ITex6");
    public final static EInputRegister ITex7 = new EInputRegister("ITex7");
    public final static EInputRegister InputRegisterCount = new EInputRegister("InputRegisterCount");

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static EInputRegister swigToEnum(int swigValue) {
      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
        return swigValues[swigValue];
      for (int i = 0; i < swigValues.length; i++)
        if (swigValues[i].swigValue == swigValue)
          return swigValues[i];
      throw new IllegalArgumentException("No enum " + EInputRegister.class + " with value " + swigValue);
    }

    private EInputRegister(String swigName) {
      this.swigName = swigName;
      this.swigValue = swigNext++;
    }

    private EInputRegister(String swigName, int swigValue) {
      this.swigName = swigName;
      this.swigValue = swigValue;
      swigNext = swigValue+1;
    }

    private EInputRegister(String swigName, EInputRegister swigEnum) {
      this.swigName = swigName;
      this.swigValue = swigEnum.swigValue;
      swigNext = this.swigValue+1;
    }

    private static EInputRegister[] swigValues = { IPosition, IWeight, INormal, IPrimaryColor, ISecondaryColor, IFogCoord, IPaletteSkin, IEmpty, ITex0, ITex1, ITex2, ITex3, ITex4, ITex5, ITex6, ITex7, InputRegisterCount };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

  public final static class EOutputRegister {
    public final static EOutputRegister OHPosition = new EOutputRegister("OHPosition", nel3dJNI.CVPOperand_OHPosition_get());
    public final static EOutputRegister OPrimaryColor = new EOutputRegister("OPrimaryColor");
    public final static EOutputRegister OSecondaryColor = new EOutputRegister("OSecondaryColor");
    public final static EOutputRegister OBackFacePrimaryColor = new EOutputRegister("OBackFacePrimaryColor");
    public final static EOutputRegister OBackFaceSecondaryColor = new EOutputRegister("OBackFaceSecondaryColor");
    public final static EOutputRegister OFogCoord = new EOutputRegister("OFogCoord");
    public final static EOutputRegister OPointSize = new EOutputRegister("OPointSize");
    public final static EOutputRegister OTex0 = new EOutputRegister("OTex0");
    public final static EOutputRegister OTex1 = new EOutputRegister("OTex1");
    public final static EOutputRegister OTex2 = new EOutputRegister("OTex2");
    public final static EOutputRegister OTex3 = new EOutputRegister("OTex3");
    public final static EOutputRegister OTex4 = new EOutputRegister("OTex4");
    public final static EOutputRegister OTex5 = new EOutputRegister("OTex5");
    public final static EOutputRegister OTex6 = new EOutputRegister("OTex6");
    public final static EOutputRegister OTex7 = new EOutputRegister("OTex7");
    public final static EOutputRegister OutputRegisterCount = new EOutputRegister("OutputRegisterCount");

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static EOutputRegister swigToEnum(int swigValue) {
      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
        return swigValues[swigValue];
      for (int i = 0; i < swigValues.length; i++)
        if (swigValues[i].swigValue == swigValue)
          return swigValues[i];
      throw new IllegalArgumentException("No enum " + EOutputRegister.class + " with value " + swigValue);
    }

    private EOutputRegister(String swigName) {
      this.swigName = swigName;
      this.swigValue = swigNext++;
    }

    private EOutputRegister(String swigName, int swigValue) {
      this.swigName = swigName;
      this.swigValue = swigValue;
      swigNext = swigValue+1;
    }

    private EOutputRegister(String swigName, EOutputRegister swigEnum) {
      this.swigName = swigName;
      this.swigValue = swigEnum.swigValue;
      swigNext = this.swigValue+1;
    }

    private static EOutputRegister[] swigValues = { OHPosition, OPrimaryColor, OSecondaryColor, OBackFacePrimaryColor, OBackFaceSecondaryColor, OFogCoord, OPointSize, OTex0, OTex1, OTex2, OTex3, OTex4, OTex5, OTex6, OTex7, OutputRegisterCount };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

}
